<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--360浏览器优先以webkit内核解析-->
    <title>若依介绍</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
    <link href="../static/css/jinrishuju.css" th:href="@{/css/jinrishuju.css}" rel="stylesheet"/>
</head>

<body class="gray-bg" style="overflow-x: scroll">
<div class="ibox-content no-padding">
    <div class="panel-body">
        <div class="box3" th:if="${session.QuanXian == '1'}" style="overflow-y: hidden;overflow-x: hidden;">
            <div class="a" style="top: 3%;">本周销售数量排行</div>
            <div class="col-md-12" style="top: 9%;display: flex;padding: 0 0 0 0;">
                <div class="b" style="width: 10%;text-align: center">日期</div>
                <div class="b" style="width: 20%;text-align: center">单号</div>
                <div class="b" style="width: 20%;text-align: center">项目名称</div>
                <div class="b" style="width: 15%;text-align: center">业务员</div>
                <div class="b" style="width: 20%;text-align: center">产品名称</div>
                <div class="b" style="width: 12%;text-align: center">数量</div>
            </div>
            <div class="i" style="height: 3px;width: 98%;top:12%;left: 2%"></div>
            <div class="col-md-12" id="week2main" style="position: absolute;top: 13%;padding: 0 0 0 0;height: 50%;overflow-y: scroll;overflow-x: hidden;">
            </div>

            <div class="a" style="top: 65%">最近销售单据</div>
            <div style="position: absolute;top: 71%;display: flex;padding: 0 0 0 0;" class="col-md-12">
                <div class="b" style="width: 10%;text-align: center">日期</div>
                <div class="b" style="width: 20%;text-align: center">单号</div>
                <div class="b" style="width: 20%;text-align: center">项目名称</div>
                <div class="b" style="width: 15%;text-align: center">业务员</div>
                <div class="b" style="width: 20%;text-align: center">产品名称</div>
                <div class="b" style="width: 12%;text-align: center">数量</div>
                <div class="b" style="width: 16%;text-align: center">是否已出库</div>
            </div>
            <div class="i" style="height: 3px;width: 98%;top:75%;left: 2%"></div>
            <div class="col-md-12" style="position: absolute;top: 76%;padding: 0 0 0 0;" id="last2xiaoshou">
            </div>

        </div>
        <div class="box1" th:if="${session.QuanXian == '1'}">
            <div class="col-md-12" id="TheToMonth">
                <div class="col-md-2" style="padding-right: 0;font-size: 26px;padding-top: 2%;color: #ecae0e;width: 18%;">月营业额</div>
            </div>
            <div class="i" style="height: 3px;width: 95%;top:8%;left: 4%"></div>
            <div class="a">
                <div class="col-sm-2" style="padding-right: 0">日营业额</div>
                <div class="col-sm-10" style="font-size: 15px;color: black;">
                    <div class="col-sm-6">
                        <label class="col-sm-5 control-label" style="margin-top: 3px;">起始时间：</label>
                        <input class="col-sm-7" type="date" id="startDate"/>
                    </div>
                    <div class="col-sm-6">
                        <label class="col-sm-5 control-label" style="margin-top: 3px;">结束时间：</label>
                        <input class="col-sm-7" type="date" id="endDate"/>
                    </div>
                    <div class="col-sm-6">
                        <label class="col-sm-5 control-label" style="margin-top: 3px;">发货人：</label>
                        <input class="col-sm-7" type="text" id="yeWuYuan"/>
                    </div>
                    <div class="col-sm-2">
                        <button style="width: 100%;height: 100%;color: black;margin-left: 12px" onclick="select2mainSearch(
                                                document.getElementById('startDate').value,
                                                document.getElementById('endDate').value,
                                                document.getElementById('yeWuYuan').value
                                            )">
                            筛选
                        </button>
                    </div>
                </div>
            </div>
            <div style="width: 100%;margin-top: 18%;font-size: 20px;color:black;height: auto;">
                <div class="col-sm-12">
                    <div class="col-sm-3" style="text-align: center;">汇总日期</div>
                    <div class="col-sm-3" style="text-align: center;">发货人</div>
                    <div class="col-sm-2" style="text-align: center;">成本汇总</div>
                    <div class="col-sm-2" style="text-align: center;">毛利</div>
                    <div class="col-sm-2" style="text-align: center;">销售总额</div>
                </div>
            </div>
            <div class="i" style="height: 3px;width: 95%;top:24%;left: 4%"></div>

            <div id="svgtest" style="width: 100%;margin-top: 24%;font-size: 20px;color: black;height: 77%;"></div>

        </div>
        <div class="box1" th:if="${session.QuanXian == '5'}">
            <div class="a" style="top: 3%;">本周未出库单据</div>
<!--            通知单图片，出库单号，项目名，两个配套类型，总金额-->
            <div style="position: absolute;display: flex;padding: 0 0 0 0;top: 10%;" class="col-md-12">
                <div class="b" style="width: 10%;text-align: center">日期</div>
                <div class="b" style="width: 20%;text-align: center">出库单号</div>
                <div class="b" style="width: 15%;text-align: center">项目名</div>
                <div class="b" style="width: 15%;text-align: center">商品名</div>
                <div class="b" style="width: 12%;text-align: center">配套五金</div>
                <div class="b" style="width: 12%;text-align: center">总金额</div>
                <div class="b" style="width: 12%;text-align: center">通知单</div>
            </div>
            <div class="i" style="height: 3px;width: 98%;top:14%;left: 1%"></div>
            <div id="weiChuFor" class="col-md-12" style="position: absolute;top: 15%;padding: 0 0 0 0;"></div>
        </div>
        <div class="box3" th:if="${session.QuanXian == '5'}">
            <div class="a" id="yichu" style="top: 3%;">本周已出库单据</div>
            <div style="position: absolute;display: flex;padding: 0 0 0 0;top: 10%;" class="col-md-12">
                <div class="b" style="width: 10%;text-align: center">日期</div>
                <div class="b" style="width: 20%;text-align: center">出库单号</div>
                <div class="b" style="width: 15%;text-align: center">项目名</div>
                <div class="b" style="width: 15%;text-align: center">商品名</div>
                <div class="b" style="width: 12%;text-align: center">配套五金</div>
                <div class="b" style="width: 12%;text-align: center">总金额</div>
                <div class="b" style="width: 12%;text-align: center">通知单</div>
            </div>
            <div class="i" style="height: 3px;width: 98%;top:14%;left: 1%"></div>
            <div id="yiChuFor" class="col-md-12" style="position: absolute;top: 15%;padding: 0 0 0 0;"></div>
        </div>
        <div class="box6" th:if="${session.QuanXian == '6'}">

            <div class="col-sm-12 select-table table-striped">
                <div class="a" style="top: 2%">未出库单据</div>
                <table id="table2main" class="table2main"></table>
            </div>
        </div>
        <div class="box5" th:if="${session.QuanXian == '6'}">
            <div class="col-md-12" style="margin-top: 15px">
                <div style="font-size: xx-large;color: #ecae0e;" class="col-md-8">
                    排班表
                </div>
                <div class="col-md-4" style="margin-top: 2.5%">
                    <button style="width: 100%;height: 100%;" class="btn btn-success" onclick="qianDao2today()">签到</button>
                </div>
            </div>
            <div class="col-md-12" style="margin-top: 15px">
                <table class="PaiBanTable2main" id="paiBan2after"></table>
            </div>
        </div>
        <div class="box4">
            <div class="i" style="height: 100%;margin-left: 50%;width: 3px;"></div>
            <div class="col-md-12" style="font-size: xx-large;color: #ecae0e;">库存数量</div>
            <div class="col-md-12">
                <div class="col-md-6" style="display: flex;font-size: 20px">
                    <div style="width: 10%;text-align: center">名称</div>
                    <div style="width: 21%;text-align: center">类型</div>
                    <div style="width: 20%;text-align: center">规格</div>
                    <div style="width: 14%;text-align: center">开向</div>
                    <div style="width: 14%;text-align: center">数量</div>
                    <div style="width: 10%;text-align: center">进价</div>
                    <div style="width: 20%;text-align: center">进货厂商</div>
                    <div style="width: 14%;text-align: center">成本价</div>
                </div>
                <div class="col-md-6" style="display: flex;font-size: 20px">
                    <div style="width: 10%;text-align: center">名称</div>
                    <div style="width: 21%;text-align: center">类型</div>
                    <div style="width: 20%;text-align: center">规格</div>
                    <div style="width: 14%;text-align: center">开向</div>
                    <div style="width: 14%;text-align: center">数量</div>
                    <div style="width: 10%;text-align: center">进价</div>
                    <div style="width: 20%;text-align: center">进货厂商</div>
                    <div style="width: 14%;text-align: center">成本价</div>
                </div>
                <div class="i" style="height: 3px;margin-top: 2%;width: 98%;"></div>

            </div>
            <div style="margin-top: 1%" class="col-md-12" id="kuCunMain">
            </div>
        </div>
    </div>
</div>
<div hidden id="quanxian" th:value="${session.QuanXian}"></div>
<!--<div hidden id="quanxiantest" th:object="${quanxiantest}"></div>-->
<div hidden id="weiZhiXing" th:value="${session.weiZhiXing}"></div>
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/ruoyi/js/ry-ui.js}"></script>
<script th:src="@{/ruoyi/js/common.js}"></script>
<script type="text/javascript">
    function qianDao2today() {
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/qianDao2today",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
                if (result === "1"){
                    alert("签到成功")
                }else {
                    alert("今天您不值班或签到失败")
                }
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });
    }
    $('#pay-qrcode').click(function () {
        var html = $(this).html();
        parent.layer.open({
            title: false,
            type: 1,
            closeBtn: false,
            shadeClose: true,
            area: ['600px', '360px'],
            content: html
        });
    });
    let bo = false
    window.addEventListener('DOMContentLoaded', (event) => {
        f()
    });

    function f() {
        var value1 = document.querySelector('div[id="weiZhiXing"]').getAttribute("value")
        //console.log(value1)
        if (value1 === "1" && !bo) {
            alert("有未扫码出库的单子，请及时扫码出库")
            bo = true
        }
    }
</script>
<script type="text/javascript">
    window.onload = function() {
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/QuanXian",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
                if (result === "1"){
                    select2mainSearch(new Date(window.Date.now()).setHours(-148), window.Date.now(), null);
                    XiaoShouSearch2Main();
                    XiaoShouSearch2New();
                    ToTheMonth();
                }
                if (result === '5'){
                    weichu();
                    yichu();
                }
                if (result === '6'){
                    weiZhiXing();
                    paiBan();
                }
                XiaoShouSearch2KuCun()
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });
    };

    function select2mainSearch(value1, value2, value3) {
        let lists;
        $.ajax({
            type: "POST",
            datatype: "string",
            url: "/api/select2mainSearch",
            data: {
                startDate: value1,
                endDate: value2,
                yewuyuan: value3
            },
            async: false,//是否是异步请求
            success: function (result) {
                lists = result
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });
        var thesvg = document.getElementById("svgtest")
        $("#svgtest").empty();
        for (let i = 0; i < lists.length; i++) {
            var div1 = document.createElement("div")
            div1.className = "col-sm-12"
            div1.style.marginTop = "10px"

            var tr1 = document.createElement("div")
            tr1.className = "col-sm-3"
            tr1.style.textAlign = "center"
            tr1.innerHTML = lists[i].dateNow.split(" ")[0]

            var tr2 = document.createElement("div")
            tr2.className = "col-sm-3"
            tr2.style.textAlign = "center"
            tr2.innerHTML = lists[i].fahuoren

            var tr3 = document.createElement("div")
            tr3.className = "col-sm-2"
            tr3.style.textAlign = "center"
            tr3.innerHTML = lists[i].chengben

            var tr4 = document.createElement("div")
            tr4.className = "col-sm-2"
            tr4.style.textAlign = "center"
            tr4.innerHTML = lists[i].maoli

            var tr5 = document.createElement("div")
            tr5.className = "col-sm-2"
            tr5.style.textAlign = "center"
            tr5.innerHTML = lists[i].shoujia

            div1.appendChild(tr1)
            div1.appendChild(tr2)
            div1.appendChild(tr3)
            div1.appendChild(tr4)
            div1.appendChild(tr5)

            thesvg.appendChild(div1)
        }
    }

    function XiaoShouSearch2Main() {
        let lists;
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/XiaoShouSearch2Main",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
            lists = result;
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });
        var mainSearch = document.getElementById("week2main")
        $("div[id='week2main']").empty()
        for (let i = 0; i < lists.length; i++) {
            var outside = document.createElement("div")
            outside.className = "col-md-12"
            outside.style.marginTop = "1.5%"
            outside.style.display = "flex"
            outside.style.padding = "0 0 0 0"

            var date = document.createElement("div")
            date.className = "b"
            date.style.width = "10%"
            date.style.textAlign = "center"
            date.innerHTML = lists[i].date.split(" ")[0].substring(6)
            outside.appendChild(date)

            var danhao = document.createElement("div")
            danhao.className = "b"
            danhao.style.width = "20%"
            danhao.style.textAlign = "center"
            danhao.innerHTML = lists[i].danhao
            outside.appendChild(danhao)

            var xiangmumingcheng = document.createElement("div")
            xiangmumingcheng.className = "b"
            xiangmumingcheng.style.width = "20%"
            xiangmumingcheng.style.textAlign = "center"
            xiangmumingcheng.innerHTML = lists[i].xiangmuName
            outside.appendChild(xiangmumingcheng)

            var yewuyuan = document.createElement("div")
            yewuyuan.className = "b"
            yewuyuan.style.width = "15%"
            yewuyuan.style.textAlign = "center"
            yewuyuan.innerHTML = lists[i].yewuyuan
            outside.appendChild(yewuyuan)

            var Chanpinming = document.createElement("div")
            Chanpinming.className = "b"
            Chanpinming.style.width = "20%"
            Chanpinming.style.textAlign = "center"
            Chanpinming.innerHTML = lists[i].chanpinming
            outside.appendChild(Chanpinming)

            var shuliang = document.createElement("div")
            shuliang.className = "b"
            shuliang.style.width = "12%"
            shuliang.style.textAlign = "center"
            shuliang.innerHTML = lists[i].shuliang
            outside.appendChild(shuliang)

            mainSearch.appendChild(outside)
        }
    }

    function XiaoShouSearch2New() {
        let lists;
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/XiaoShouSearch2New",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
                lists = result
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });

        var mainSearch = document.getElementById("last2xiaoshou")
        $("div[id='last2xiaoshou']").empty()
        for (let i = 0; i < lists.length; i++) {
            var outside = document.createElement("div")
            outside.className = "col-md-12"
            outside.style.marginTop = "1.5%"
            outside.style.display = "flex"
            outside.style.padding = "0 0 0 0"

            var date = document.createElement("div")
            date.className = "b"
            date.style.width = "10%"
            date.style.textAlign = "center"
            date.innerHTML = lists[i].date.split(" ")[0].substring(6)
            outside.appendChild(date)

            var danhao = document.createElement("div")
            danhao.className = "b"
            danhao.style.width = "20%"
            danhao.style.textAlign = "center"
            danhao.innerHTML = lists[i].danhao
            outside.appendChild(danhao)

            var xiangmumingcheng = document.createElement("div")
            xiangmumingcheng.className = "b"
            xiangmumingcheng.style.width = "20%"
            xiangmumingcheng.style.textAlign = "center"
            xiangmumingcheng.innerHTML = lists[i].xiangmuName
            outside.appendChild(xiangmumingcheng)

            var yewuyuan = document.createElement("div")
            yewuyuan.className = "b"
            yewuyuan.style.width = "15%"
            yewuyuan.style.textAlign = "center"
            yewuyuan.innerHTML = lists[i].yewuyuan
            outside.appendChild(yewuyuan)

            var Chanpinming = document.createElement("div")
            Chanpinming.className = "b"
            Chanpinming.style.width = "20%"
            Chanpinming.style.textAlign = "center"
            Chanpinming.innerHTML = lists[i].chanpinming
            outside.appendChild(Chanpinming)

            var shuliang = document.createElement("div")
            shuliang.className = "b"
            shuliang.style.width = "12%"
            shuliang.style.textAlign = "center"
            shuliang.innerHTML = lists[i].shuliang
            outside.appendChild(shuliang)

            var chuku = document.createElement("div")
            chuku.className = "b"
            chuku.style.width = "16%"
            chuku.style.textAlign = "center"
            chuku.innerHTML = lists[i].zhixing
            outside.appendChild(chuku)

            mainSearch.appendChild(outside)
        }
    }

    function ToTheMonth() {
        let lists;
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/toTheMonth",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
                lists = result
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });

        var mainSearch = document.getElementById("TheToMonth")
        var div1 = document.createElement("div")
        div1.className = "col-md-3"
        div1.style.textAlign = "center"
        div1.style.fontSize = "25px"
        div1.style.padding = "2% 0 0 0"
        div1.style.color = "black"
        div1.innerHTML = "成本："+lists[0].chengben
        mainSearch.appendChild(div1)

        div1 = document.createElement("div")
        div1.className = "col-md-3"
        div1.style.textAlign = "center"
        div1.style.fontSize = "25px"
        div1.style.padding = "2% 0 0 0"
        div1.style.color = "black"
        div1.innerHTML = "毛利："+lists[0].maoli
        mainSearch.appendChild(div1)

        div1 = document.createElement("div")
        div1.className = "col-md-4"
        div1.style.textAlign = "center"
        div1.style.fontSize = "25px"
        div1.style.padding = "2% 0 0 0"
        div1.style.width = "32%"
        div1.style.color = "black"
        div1.innerHTML="营业额："+lists[0].shoujia
        mainSearch.appendChild(div1)
    }

    function XiaoShouSearch2KuCun() {
        let lists;
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/XiaoShouSearch2KuCun",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
                lists = result
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });

        var mainSearch = document.getElementById("kuCunMain")
        mainSearch.style.fontSize = "20px"
        $("div[id='kuCunMain']").empty()
        var md4,md12,div1,div2,div3,div4,div5,div6,div7,div8

        for (let i = 0; i < lists.length; i++) {
            md4 = document.createElement("div")
            md4.className = "col-md-6"
            md4.style.padding = "0 0 0 0"

            md12 = document.createElement("div")
            md12.className = "col-md-12"
            md12.style.display = "flex"
            md4.appendChild(md12)

            div1 = document.createElement("div")
            div1.style.width = "10%"
            div1.style.textAlign = "center"
            div1.innerHTML = lists[i].shangPinMing
            md12.appendChild(div1)

            div2 = document.createElement("div")
            div2.style.width = "21%"
            div2.style.textAlign = "center"
            div2.innerHTML = lists[i].shangPinLeiBie
            md12.appendChild(div2)

            div7 = document.createElement("div")
            div7.style.width = "20%"
            div7.style.textAlign = "center"
            if (lists[i].guiGeKuan === null) {
                div7.innerHTML = null
            }else {
                div7.innerHTML = lists[i].guiGeKuan + " * " + lists[i].guiGeGao
            }
            md12.appendChild(div7)

            div8 = document.createElement("div")
            div8.style.width = "14%"
            div8.style.textAlign = "center"
            div8.innerHTML = lists[i].kaiXiang
            md12.appendChild(div8)

            div3 = document.createElement("div")
            div3.style.width = "14%"
            div3.style.textAlign = "center"
            div3.innerHTML = lists[i].kuCunShu
            md12.appendChild(div3)

            div4 = document.createElement("div")
            div4.style.width = "10%"
            div4.style.textAlign = "center"
            div4.innerHTML = lists[i].jinHuoJia
            md12.appendChild(div4)

            div5 = document.createElement("div")
            div5.style.width = "20%"
            div5.style.textAlign = "center"
            div5.innerHTML = lists[i].jinHuoChangJia
            md12.appendChild(div5)

            div6 = document.createElement("div")
            div6.style.width = "14%"
            div6.style.textAlign = "center"
            div6.innerHTML = lists[i].chengBen
            md12.appendChild(div6)

            mainSearch.appendChild(md4)
        }
    }

    function yichu() {
        let lists;
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/XiaoShouSearch2YiChuKu",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
                lists = result
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });

        var mainSearch = document.getElementById("yiChuFor")
        for (let i = 0; i < lists.length; i++) {
            var outside = document.createElement("div")
            outside.className = "col-md-12"
            outside.style.marginTop = "1.5%"
            outside.style.display = "flex"
            outside.style.padding = "0 0 0 0"

            var date = document.createElement("div")
            date.className = "b"
            date.style.width = "10%"
            date.style.textAlign = "center"
            date.innerHTML = lists[i].chukuDate.substring(6)
            outside.appendChild(date)

            var danhao = document.createElement("div")
            danhao.className = "b"
            danhao.style.width = "20%"
            danhao.style.textAlign = "center"
            danhao.innerHTML = lists[i].fahuoDanhao
            outside.appendChild(danhao)

            var xiangmumingcheng = document.createElement("div")
            xiangmumingcheng.className = "b"
            xiangmumingcheng.style.width = "15%"
            xiangmumingcheng.style.textAlign = "center"
            xiangmumingcheng.innerHTML = lists[i].xiangmuName
            outside.appendChild(xiangmumingcheng)

            var yewuyuan = document.createElement("div")
            yewuyuan.className = "b"
            yewuyuan.style.width = "15%"
            yewuyuan.style.textAlign = "center"
            yewuyuan.innerHTML = lists[i].peitao1
            outside.appendChild(yewuyuan)

            var Chanpinming = document.createElement("div")
            Chanpinming.className = "b"
            Chanpinming.style.width = "12%"
            Chanpinming.style.textAlign = "center"
            Chanpinming.innerHTML = lists[i].peitao2
            outside.appendChild(Chanpinming)

            var shuliang = document.createElement("div")
            shuliang.className = "b"
            shuliang.style.width = "12%"
            shuliang.style.textAlign = "center"
            shuliang.innerHTML = lists[i].zhonjine
            outside.appendChild(shuliang)

            var tuPian = document.createElement("div")
            tuPian.className = "b"
            // tuPian.style.width = "10%"
            // tuPian.style.textAlign = "center"
            // tuPian.onclick = tupianClick(lists[i].id)
            // tuPian.style.fontSize = "12px"
            // tuPian.innerHTML
            var tupiana = document.createElement("button")
            tupiana.className = "btn btn-success"
            tupiana.style.marginTop = "-5px"
            tupiana.innerText = "出库通知单"
            // tupiana.onclick = tupianClick(lists[i].id)
            tupiana.setAttribute("onclick","tupianClick("+lists[i].id+")")
            tuPian.appendChild(tupiana)
            outside.appendChild(tuPian)
            mainSearch.appendChild(outside)
        }
    }

    function tupianClick(id) {
        $.ajax({
            type:"get",
            datatype: "string",
            url: "/xiaoshouchuku/chukuTest/showOne/"+id,
            data: {},
            async:false,//是否是异步请求
            success: function (result) {
                if (result.code === 0) {
                    $.modal.open('出库通知单','/xiaoshouchuku/chukuTest/showOne',1000,800)
                }else {
                    alert("单据详细未找到")
                }
            },
            error : function() {
                alert("后台响应出现问题");
            }
        });
    }

    function weichu() {
        let lists;
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/XiaoShouSearch2WeiChuKu",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
                lists = result
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });

        var mainSearch = document.getElementById("weiChuFor")
        for (let i = 0; i < lists.length; i++) {
            var outside = document.createElement("div")
            outside.className = "col-md-12"
            outside.style.marginTop = "1.5%"
            outside.style.display = "flex"
            outside.style.padding = "0 0 0 0"

            var date = document.createElement("div")
            date.className = "b"
            date.style.width = "10%"
            date.style.textAlign = "center"
            date.innerHTML = lists[i].chukuDate.substring(6)
            outside.appendChild(date)

            var danhao = document.createElement("div")
            danhao.className = "b"
            danhao.style.width = "20%"
            danhao.style.textAlign = "center"
            danhao.innerHTML = lists[i].fahuoDanhao
            outside.appendChild(danhao)

            var xiangmumingcheng = document.createElement("div")
            xiangmumingcheng.className = "b"
            xiangmumingcheng.style.width = "15%"
            xiangmumingcheng.style.textAlign = "center"
            xiangmumingcheng.innerHTML = lists[i].xiangmuName
            outside.appendChild(xiangmumingcheng)

            var yewuyuan = document.createElement("div")
            yewuyuan.className = "b"
            yewuyuan.style.width = "15%"
            yewuyuan.style.textAlign = "center"
            yewuyuan.innerHTML = lists[i].peitao1
            outside.appendChild(yewuyuan)

            var Chanpinming = document.createElement("div")
            Chanpinming.className = "b"
            Chanpinming.style.width = "12%"
            Chanpinming.style.textAlign = "center"
            Chanpinming.innerHTML = lists[i].peitao2
            outside.appendChild(Chanpinming)

            var shuliang = document.createElement("div")
            shuliang.className = "b"
            shuliang.style.width = "12%"
            shuliang.style.textAlign = "center"
            shuliang.innerHTML = lists[i].zhonjine
            outside.appendChild(shuliang)

            var tuPian = document.createElement("div")
            tuPian.className = "b"
            // tuPian.style.width = "10%"
            // tuPian.style.textAlign = "center"
            // tuPian.onclick = tupianClick(lists[i].id)
            // tuPian.style.fontSize = "12px"
            // tuPian.innerHTML
            var tupiana = document.createElement("button")
            tupiana.className = "btn btn-success"
            tupiana.style.marginTop = "-5px"
            tupiana.innerText = "出库通知单"
            // tupiana.onclick = tupianClick(lists[i].id)
            tupiana.setAttribute("onclick","tupianClick("+lists[i].id+")")
            tuPian.appendChild(tupiana)
            outside.appendChild(tuPian)
            mainSearch.appendChild(outside)
        }
    }

    function SomeOneSaoMa(id) {
        $.ajax({
            type:"POST",
            datatype: "string",
            url: "/xiaoshouchuku/SaoMaTest/selectOne/"+id,
            data: {},
            async:false,//是否是异步请求
            success: function (result) {
                console.log(result)
                if (result.code===0) {
                    $.modal.parentTab('开始扫码','/xiaoshouchuku/SaoMaTest/selectOne')
                    // $.modal.open('开始扫码','/xiaoshouchuku/SaoMaTest/selectOne',1000,800)
                }else {
                    alert("单据详细未找到")
                }
            },
            error : function() {
                alert("后台响应出现问题");
            }
        });
    }

    function weiZhiXing() {
        let lists;
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/XiaoShouChuKuSearch2WeiChuKu",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
                lists = result
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });

        var mainSearch = document.getElementById("table2main")
        var tr2th = document.createElement("tr")
        var th1 = document.createElement("th")
        th1.innerHTML = "发货通知单"
        tr2th.appendChild(th1)

        var th3 = document.createElement("th")
        th3.innerHTML = "发货单号"
        tr2th.appendChild(th3)

        var th4 = document.createElement("th")
        th4.innerHTML = "销售日期"
        tr2th.appendChild(th4)

        var th5 = document.createElement("th")
        th5.innerHTML = "项目名称"
        tr2th.appendChild(th5)

        var th7 = document.createElement("th")
        th7.innerHTML = "发货人"
        tr2th.appendChild(th7)

        var th8 = document.createElement("th")
        th8.innerHTML = "配套类型"
        tr2th.appendChild(th8)

        var th9 = document.createElement("th")
        th9.innerHTML = "门扇名称"
        tr2th.appendChild(th9)

        var th10 = document.createElement("th")
        th10.innerHTML = "规格和开向"
        tr2th.appendChild(th10)

        var th11 = document.createElement("th")
        th11.innerHTML = "门扇数量"
        tr2th.appendChild(th11)

        var th12 = document.createElement("th")
        th12.innerHTML = "右门扇数量"
        tr2th.appendChild(th12)

        var th13 = document.createElement("th")
        th13.innerHTML = "门框数量"
        tr2th.appendChild(th13)

        var th14 = document.createElement("th")
        th14.innerHTML = "防火锁数"
        tr2th.appendChild(th14)

        var th15 = document.createElement("th")
        th15.innerHTML = "闭门器数"
        tr2th.appendChild(th15)

        var th16 = document.createElement("th")
        th16.innerHTML = "拉爆盖数"
        tr2th.appendChild(th16)

        var th17 = document.createElement("th")
        th17.innerHTML = "门扇备注"
        tr2th.appendChild(th17)

        var th6 = document.createElement("th")
        th6.innerHTML = "业务员"
        tr2th.appendChild(th6)

        var th18 = document.createElement("th")
        th18.innerHTML = "销售金额"
        tr2th.appendChild(th18)

        var th19 = document.createElement("th")
        th19.innerHTML = "整单出库"
        tr2th.appendChild(th19)

        mainSearch.appendChild(tr2th)

        for (let i = 0; i < lists.length; i++) {
            var tr = document.createElement("tr")

            var td1 = document.createElement("td")
            var tda = document.createElement("a")
            tda.className = "btn btn-success btn-xs"
            tda.setAttribute("onclick","tupianClick("+lists[i].id+")")
            var tdai = document.createElement("i")
            tdai.className = "fa fa-plus"
            tda.appendChild(tdai)
            tda.innerHTML = "出库通知单"
            td1.appendChild(tda)
            tr.appendChild(td1)

            var fahuoDanhao = document.createElement("td")
            fahuoDanhao.innerHTML = lists[i].fahuoDanhao
            tr.appendChild(fahuoDanhao)

            var chukuDate = document.createElement("td")
            chukuDate.innerHTML = lists[i].chukuDate
            tr.appendChild(chukuDate)

            var xiangmuName = document.createElement("td")
            xiangmuName.innerHTML = lists[i].xiangmuName
            tr.appendChild(xiangmuName)

            var fahuoRen = document.createElement("td")
            fahuoRen.innerHTML = lists[i].fahuoRen
            tr.appendChild(fahuoRen)

            var peitao1 = document.createElement("td")
            peitao1.innerHTML = lists[i].peitao1
            tr.appendChild(peitao1)

            var goodNameMen1 = document.createElement("td")
            goodNameMen1.innerHTML = lists[i].goodNameMen1
            if (lists[i].goodNameMen1 !== null){
                goodNameMen1.innerHTML = lists[i].goodNameMen1
            }
            if (lists[i].goodNameMen1 === null && lists[i].goodNameKuang !== null){
                goodNameMen1.innerHTML = lists[i].goodNameKuang
            }
            if (lists[i].goodNameMen1 === null && lists[i].goodNameKuang === null){
                if (lists[i].peitao2 === "常规五金配套"){
                    goodNameMen1.innerHTML = "五金"
                }
                if (lists[i].peitao2 === "单要防火锁"){
                    goodNameMen1.innerHTML = "防火锁"
                }
                if (lists[i].peitao2 === "单要闭门器"){
                    goodNameMen1.innerHTML = "闭门器"
                }
                if (lists[i].peitao2 === "单要拉爆盖"){
                    goodNameMen1.innerHTML = "拉爆盖"
                }
            }
            tr.appendChild(goodNameMen1)

            var kaiXiang1 = document.createElement("td")
            if (lists[i].men1shanKuan !== null){
                kaiXiang1.innerHTML = lists[i].men1shanKuan+"*"+lists[i].men1shanGao+"</br>"+lists[i].kaiXiang1
            }
            if (lists[i].men1shanKuan === null && lists[i].kuangKuan !== null){
                kaiXiang1.innerHTML = lists[i].kuangKuan+"*"+lists[i].kuangGao+"</br>"+lists[i].kaiXiang3
            }
            if (lists[i].men1shanKuan === null && lists[i].kuangKuan === null){
                kaiXiang1.innerHTML = ""
            }
            tr.appendChild(kaiXiang1)

            var men1Shuliang = document.createElement("td")
            men1Shuliang.innerHTML = lists[i].men1Shuliang
            tr.appendChild(men1Shuliang)

            var men2Shuliang = document.createElement("td")
            men2Shuliang.innerHTML = lists[i].men2Shuliang
            tr.appendChild(men2Shuliang)

            var kuangShuliang = document.createElement("td")
            kuangShuliang.innerHTML = lists[i].kuangShuliang
            tr.appendChild(kuangShuliang)

            var shuliang1 = document.createElement("td")
            shuliang1.innerHTML = lists[i].shuliang1
            tr.appendChild(shuliang1)

            var shuliang2 = document.createElement("td")
            shuliang2.innerHTML = lists[i].shuliang2
            tr.appendChild(shuliang2)

            var shuliang3 = document.createElement("td")
            shuliang3.innerHTML = lists[i].shuliang3
            tr.appendChild(shuliang3)

            var beizhu1 = document.createElement("td")
            beizhu1.innerHTML = lists[i].beizhu1
            tr.appendChild(beizhu1)

            var xiangmuMen = document.createElement("td")
            xiangmuMen.innerHTML = lists[i].xiangmuMen
            tr.appendChild(xiangmuMen)

            var zhonjine = document.createElement("td")
            zhonjine.innerHTML = lists[i].zhonjine
            tr.appendChild(zhonjine)

            var td2 = document.createElement("td")
            var td2a = document.createElement("a")
            td2a.className = "btn btn-success btn-xs"
            td2a.setAttribute("onclick","SomeOneSaoMa("+ lists[i].id +")")
            var td2ai = document.createElement("i")
            td2ai.className = "fa fa-plus"
            td2a.appendChild(td2ai)
            td2a.innerHTML = "整单出库"
            td2.appendChild(td2a)
            tr.appendChild(td2)

            mainSearch.appendChild(tr)
        }
    }

    function paiBan() {
        let lists;
        $.ajax({
            type: "post",
            datatype: "string",
            url: "/api/paiBan2after",
            data: {},
            async: false,//是否是异步请求
            success: function (result) {
                lists = result
            },
            error: function () {
                alert("后台响应出现问题");
            }
        });

        var mainSearch = document.getElementById("paiBan2after")

        var tr2th = document.createElement("tr")
        var th1 = document.createElement("th")
        th1.innerHTML = "排班日期"
        tr2th.appendChild(th1)

        var th3 = document.createElement("th")
        th3.innerHTML = "值班人员"
        tr2th.appendChild(th3)

        mainSearch.appendChild(tr2th)
        for (let i = 0; i < lists.length; i++) {
            var tr = document.createElement("tr")

            var date = document.createElement("td")
            date.innerHTML = lists[i].date
            tr.appendChild(date)

            var yuangongName = document.createElement("td")
            yuangongName.innerHTML = lists[i].yuangongName
            tr.appendChild(yuangongName)

            mainSearch.appendChild(tr)
        }
    }
</script>
</body>

</html>
